import request from "../utils/request";


//user的api
export function login(params){
  return request.post(`user/loginByAcc`,params,`application/x-www-form-urlencoded`)
}

export function wxlogin(params){
  return request.post(`user/wxLogin`,params,`application/x-www-form-urlencoded`)
}


export function loginByPhone(params){//参数为手机号加验证码
  return request.post(`user/loginByPhone`,params,`application/x-www-form-urlencoded`)
}

export function userPhoto(params){
  return request.get(`user/${params}/photo`)
}

export function updateUserPhotoBase64(params){
  return request.put(`user/base64Photo`,params,`application/x-www-form-urlencoded`)//参数为用户的openid和图片文件 
}

export function updatePhoto(openid,params){
    return request.put(`user/photo?openid=${openid}`,params)//参数为用户的openid和图片文件
}

// export function updateUserInfo(params){
//   return request.put(`user/info`,params)//也要传入openid
// }

export function updateUserPassword(params){
  return request.put(`user/password`,params)//也要传入openid
}

export function userSignIn(params){
  return request.post(`user/register`,params,`application/x-www-form-urlencoded`)//也要传入openid,以序列化方式传入数据
}
export function userSignInTelCheck(params){
  return request.post(`user/register/verification`,params,`application/x-www-form-urlencoded`)
}



//关于简历的api

export function submitResume(params){
  return request.post(`resume/send`,params,`application/x-www-form-urlencoded`)
}

export function userDetailInfo(params){
  return request.get(`resume/userDetailInfo/${params}`)//用户的openid
}

export function updateResume(params){
  return request.put(`user/info/`,params,)//用户的openid
}

export function getSkillCertificate(openid){//职业技能证书
  return request.get(`user/${openid}/skillCertificate`)
}

export function updateSkillCertificate(params){//更新职业技能证书
  return request.put(`user/skillCertificate/base64`,params,`application/x-www-form-urlencoded`)
}
export function postSkillCertificate(params){//上传新职业技能证书
  return request.post(`user/skillCertificate/base64`,params,`application/x-www-form-urlencoded`)
}
export function putAllSkillCertificate(params){//上传全部职业技能证书
  return request.put(`user/allSkillCertificate/base64`,params,`application/x-www-form-urlencoded`)
}


export function getHonorCertificate(openid){//获奖证书
  return request.get(`user/${openid}/honorCertificate`)
}
export function updateHonorCertificate(params){//更新获奖证书
  return request.put(`user/honorCertificate/base64`,params,`application/x-www-form-urlencoded`)
}
export function postHonorCertificate(params){//上传新的获奖证书
  return request.post(`user/honorCertificate/base64`,params,`application/x-www-form-urlencoded`)
}
export function putAllHonorCertificate(params){//上传全部荣誉证书
  return request.put(`user/allHonorCertificate/base64`,params,`application/x-www-form-urlencoded`)
}


//关于企业的api

export function getCompanyInfo(params){
  return request.get(`company/${params}/userChooseDetailCommon`)
}

export function getCompanyCommonInfo(params){//附带普通职位
  return request.get(`company/userChooseDetailCommon`,params,`application/x-www-form-urlencoded`)
}

export function getCompanySpecialInfo(params){//附带专场职位
  return request.get(`company/userChooseDetailSpecial`,params,`application/x-www-form-urlencoded`)
}


export function getAllCompanyArea(){//获取地区的下拉列表
  return request.get(`company/allPrimaryArea`)
}

export function getAllCompanyType(){//获取企业种类的下拉列表
  return request.get(`company/allPositionType`)
}

export function getSpecificCompany(params){
  return request.get(`company/userChooseInfo`,params)
}

//专场招聘的api

export function getSpecialInfo(params){//获取简略信息
  return request.get(`specialRecruit/allUsersideInfo`,params,`application/x-www-form-urlencoded`)
}

export function getSpecialDetailInfo(params){//获取专场招聘的详细信息
  return request.get(`specialRecruit/${params}/usersideDetailInfo`)
}

//职位的api

export function getSuggestPositionByTime(openid,params){
  return request.get(`position/suggestOrderByTime/${openid}`,params,)//openid
}

export function getSuggestPositionBySal(openid,params){
  return request.get(`position/suggestOrderBySal/${openid}`,params)//openid
}

export function getAllPosition(){//获取所有职位？
  return request.get(`position/databaseInfo`)
}

export function getMyPost(params){//获取所有职位？
  return request.get(`resume/userResumeSendList/${params}`)//openid
}

export function getPositionDetailInfo(openid,positionid){
  return request.get(`position/usersideDetailInfo?openid=${openid}&positionId=${positionid}`)
}

export function getAllPositionArea(){//获取地区的下拉列表
  return request.get(`position/allArea`)
}

export function getAllPositionPositionType(){//获取职位种类的下拉列表
  return request.get(`position/allPositionType`)
}

export function getSpecificPosition(params){//获取特定地区、职位种类、薪资要求的工作
  return request.get(`position/usersideInfo`,params)
}

//展示消息的api

export function showAboutUs(){
  return request.get(`display/aboutUs`)
}

export function showPrivacyPolicy(){
  return request.get(`display/privacyPolicy`)
}

export function showcooperativeUnit(){
  return request.get(`display/cooperativeUnit`)
}

export function showBanner(){
  return request.get(`display/banner/showInfoList`)
}



//用户收藏相关的api
export function getFavorite(params){
  return request.get(`user/${params}/collection`)
}

export function addFavoriteCompany(params){
  return request.post(`user/collection/company`,params,`application/x-www-form-urlencoded`)
}

export function addFavoritePosition(params){
  return request.post(`user/collection/companyAndPosition`,params,`application/x-www-form-urlencoded`)
}


//验证码相关的api
export function registerVerification(params){//参数为电话号码
  return request.get(`verification/register?loginType=user&&phone=${params}`)
}

export function loginVerification(params){//参数为电话号码
  return request.get(`verification/login?loginType=user&&phone=${params}`)
}

export function changePasswordVerification(params){//参数为电话号码
  return request.get(`verification/changePassword?loginType=user&&phone=${params}`)
}